﻿@model GPS.ENTITYS.CrudModelDBCI

@using (Html.BeginForm("Approval", "GPS_QuanLyBaoCaoI", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)
    <h3 class="text-center fdb-title-search-form">Thông báo</h3>
    <div class="row">
        <h4>
            @{
    string strTrangThai = "";
    if (Model.BCI_TRANGTHAI == "1")
    {
        strTrangThai = "Bạn có chắc chắn phê duyệt  báo cáo 1";
    }
    else
    {
        strTrangThai = "Bạn có chắc chắn phê duyệt  báo cáo 1";
    }
    @Html.Raw(strTrangThai)
            }
        </h4>
        <fieldset class="fs_body">
            <legend class="head_title">Thông tin chi tiết báo cáo</legend>
            @{
                <div class="row margin-top-05">
                    <div class="col-md-2 control-label text-left">
                        Mã báo cáo I:
                    </div>
                    <div class="col-md-4">
                        @Html.DisplayFor(model => model.BCI_MA)
                    </div>
                </div>

                <div class="row margin-top-05">
                    <div class="col-md-2 control-label text-left">
                        Mã đơn vị đào tạo:
                    </div>
                    <div class="col-md-4">
                        @Html.DisplayFor(model => model.BCI_DVGTVT_MA)
                    </div>
                </div>

                <div class="row margin-top-05 Action_FormDetail">
                    <div class="col-md-2 control-label text-left">
                        Mã khóa học:
                    </div>
                    <div class="col-md-4">
                        @Html.DisplayFor(model => model.BCI_KH_MA)
                    </div>
                </div>
                <p style="color:red; font-weight:inherit;">(Bấm đồng ý để phê duyệt hoặc hủy bỏ để hủy phê duyệt)</p>
                @Html.HiddenFor(model => model.BCI_MA)
                @Html.HiddenFor(model => model.BCI_KH_MA)
                @Html.HiddenFor(model => model.BCI_DVGTVT_MA)
                @Html.HiddenFor(model => model.BCI_TRANGTHAI)
            }
        </fieldset>
    </div>
    <div class="row">
        <div class="col-md-12">
            @*<input type="submit" value="Cập nhật" class="btn btn-info btn-sm" />*@
            <button type="submit" class="btn btn-danger btn-sm">
                <span class="glyphicon glyphicon-floppy-disk"></span> Đồng ý
            </button>
            &nbsp;&nbsp;
            <button class="btn btn-primary btn-sm" type="button" data-dismiss="modal">Hủy bỏ</button>
        </div>
    </div>
}

<script src="~/Scripts/jquery.validate.min.js"></script>
<script src="~/Scripts/jquery.validate.unobtrusive.min.js"></script>

<script src="~/Scripts/datepicker.js"></script>
<script src="~/Scripts/jquery-ui-1.11.4.js"></script>
<script src="~/Scripts/jquery.maskedinput.js"></script>
<script src="~/Scripts/jquery.maskMoney.js"></script>
<script src="~/Scripts/jquery.number.js"></script>
<script src="~/Scripts/jquery.masknumber.js"></script>
<script src="~/Scripts/moment.js"></script>

<script type="text/javascript">
    $(document).tooltip();
    // Voi jQuery 1.9 > thi chi validate gia tri trong active tab
    // Muon validate nhung gia tri trong cac tab khac nua thi dung jquery.validate 1.8.1 or 1.7


    // mask edit cho truong ngay thang (su dung jquery.maskedinput)


    function ToJavaScriptDate(value) {
        if (value != null) {
            var pattern = /Date\(([^)]+)\)/;
            var results = pattern.exec(value);
            var dt = new Date(parseFloat(results[1]));
            return dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear();
        }
        return null;
    }
</script>
<script type="text/javascript">


    // cho phep nhap so thap phan (su dung jquery.number)
    //$("#GV_THAMNIENLX").number(true, 2, '.', '');

</script>

@Styles.Render("~/Content/themes/base/css")

<script type="text/javascript">
    $(document).ready(function () {
        $("#HV_NOITT_DVHC_MA").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/GPS_HocVien/AutoCompleteNOICT_DVHC_MA",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.DVHC_TENDAYDU, value: item.DVHC_MA + ':' + item.DVHC_TENDAYDU };
                        }))


                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        }).click(function () {
            $(this).val("");
            $(this).autocomplete("search");
        });

        $("#HV_NOITT_DVHC_DVQL").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/GPS_HocVien/AutoCompleteNOICT_DVHC_MA",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.DVHC_TENDAYDU, value: item.DVHC_MA + ':' + item.DVHC_TENDAYDU };
                        }))


                    }
                })
            },
            messages: {
                noResults: "", results: ""
            }
        }).click(function () {
            $(this).val("");
            $(this).autocomplete("search");
        });

        $("#HV_DVGTVT_MA").autocomplete({
            source: function (request, response) {
                $.ajax({
                    url: "/GPS_HocVien/AutoCompleteDVGTVT_MA",
                    type: "POST",
                    dataType: "json",
                    data: { term: request.term },
                    success: function (data) {
                        response($.map(data, function (item) {
                            return { label: item.DVGTVT_TEN, value: item.DVGTVT_MA + ':' + item.DVGTVT_TEN };
                        }))


                    }
                })
            },
            change: function (event, ui) {
                var _val = $("#HV_DVGTVT_MA").val();
                if (_val != null && _val != '') {
                    $.ajax({
                        url: '@Url.Action("getKH_MAs", "GPS_HocVien")',
                        type: 'post',
                        data: {
                            ma_DVGT: _val
                        }
                    }).done(function (response) {
                        // update KH
                        var a = '<option value></option>' + response;   // defaut value
                        $("#ddlKH_MA").html(a);

                    });
                }
            },

            messages: {
                noResults: "", results: ""
            }
        }).click(function () {
            $(this).val("");
            $(this).autocomplete("search");
        });

        //$('#HV_DVGTVT_MA').change(function (e) {
        //    var _val = $(this).val();
        //    alert(_val);
        //});

        @*$("#HV_DVGTVT_MA").blur(function () {
            alert('1');
            var _val = $(this).val();
            if (_val != null && _val != '') {
                $.ajax({
                    url: 'getKH_MAs',
                    type: 'post',
                    data: {
                        ma_DVGT: _val
                    }
                }).done(function (response) {
                    // update KH
                    var a = '<option value></option>' + response;   // defaut value
                    $("#ddlKH_MA").html(a);

                });
                @*$.ajax({
                    url: '@Url.Action("getHV_MA", "GPS_HocVien")',
                    type: 'post',
                    data: {
                        gv_DVGTVT_MA: $('#HV_DVGTVT_MA').val()
                    }
                }).done(function (response) {

                    $('#HV_MA').val(response);
                });
            }

        });*@
    })
</script>
